import indexC from "../controllers";
import adminListC from "../controllers/adminList";
import advListC from "../controllers/advList";
import loginC from "../controllers/login";

export const sidebarRoutes = [
	{
		path:"/index/adminList",
		title:"管理员列表",
		element:adminListC()
	},
	{
		path:"/index/adminLog",
		title:"管理员日志列表",
		element(req,res){
			res.render("管理员日志列表");
		}
	},
	{
		path:"/index/advList",
		title:"广告列表",
		element:advListC()
	}
]

export default function(router){
	return [
		{
			path:"/index",
			element:indexC(router)
		},
		...sidebarRoutes,
		{
			path:"/login",
			element:loginC(router)
		},
		{
			path:"*",
			element:(req, res, next) => {
				res.redirect('/login')
			}
		}
	];
};